package field_method13;

public class Person {
    private int age;
    public Person() {
        this.age = 0;
    }
    public void setAge(int age) {
        if (age >= 0 && age <= 150) {
            this.age = age;
        } else {
            System.out.println("年龄不合法，应为0到150之间！");
        }
    }
    public int getAge() {
        return this.age;
    }
}

